package com.sq.partner.manager.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.CoinFeeConfigDao;
import com.sq.partner.manager.mybatis.model.CoinFeeConfig;
import com.sq.partner.manager.util.Page;
@Repository
public class CoinFeeConfigDaoImpl extends BaseDaoImpl implements
		CoinFeeConfigDao {

	@Override
	public boolean deleteCoinFee(String agentNo) throws Exception {
		return this.delete("deleteCoinFee", agentNo);
	}

	@Override
	public void addCoinFee(List<CoinFeeConfig> list) throws Exception {
		this.batchInsert("insertCoinFee", list);
	}

	@Override
	public CoinFeeConfig queryMaxSeq(String agentNo) throws Exception {
		return (CoinFeeConfig) this.query("queryMaxSeq", agentNo);
	}

	@Override
	public List<CoinFeeConfig> queryCoins(String agentNo) throws Exception {
		
		return this.queryList("queryCoinFee", agentNo);
	}

	@Override
	public Integer queryTotal(String planNo) throws Exception {
		// TODO Auto-generated method stub
		return (Integer) this.query("totalCoinFee", planNo);
	}

	@Override
	public Page<Map<String, Object>> queryCoinsByPage(Page<Map<String, Object>> page)
			throws Exception {

		Map<String,Object> paramMap = page.getMap();
		
		int total = (Integer) this.query("totalCoinFee", paramMap);
		page.setTotal(total);
		
		List<Map<String,Object>> resultList = this.queryList("queryCoinFeeByPage", paramMap);
		page.setData(resultList);

		return page;
	
	}

	@Override
	public List<CoinFeeConfig> searchCoinFeeConfigsListByplanCode(
			Map<String, Object> maps) throws Exception {
		// TODO Auto-generated method stub
		return this.queryList("searchCoinFeeConfigsListByplanCode", maps);
	}
	public List<Map<String, Object>> implCoinFee(
			Map<String, Object> maps) throws Exception {
		return this.queryList("implCoinFee", maps);
	}
}
